From: Jasper St. Pierre Date: Wed, 22 May 2013 18:18:39 +0000 (-0400) Subject: power: Use UPowerGlib for constants X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~3896 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=22c8be66453555338c85683d93f4661239b10c4c;p=gnome-shell.git power: Use UPowerGlib for constants This removes the need to define the constants from headers ourselves. https://bugzilla.gnome.org/show_bug.cgi?id=704368 --- diff --git a/js/ui/status/power.js b/js/ui/status/power.js index 7c7838221..20eb545ec 100644 --- a/js/ui/status/power.js +++ b/js/ui/status/power.js @@ -3,6 +3,7 @@ const Gio = imports.gi.Gio; const Lang = imports.lang; const St = imports.gi.St; +const UPower = imports.gi.UPowerGlib; const PanelMenu = imports.ui.panelMenu; const PopupMenu = imports.ui.popupMenu; @@ -10,31 +11,6 @@ const PopupMenu = imports.ui.popupMenu; const BUS_NAME = 'org.gnome.SettingsDaemon.Power'; const OBJECT_PATH = '/org/gnome/SettingsDaemon/Power'; -const UPDeviceType = { - UNKNOWN: 0, - AC_POWER: 1, - BATTERY: 2, - UPS: 3, - MONITOR: 4, - MOUSE: 5, - KEYBOARD: 6, - PDA: 7, - PHONE: 8, - MEDIA_PLAYER: 9, - TABLET: 10, - COMPUTER: 11 -}; - -const UPDeviceState = { - UNKNOWN: 0, - CHARGING: 1, - DISCHARGING: 2, - EMPTY: 3, - FULLY_CHARGED: 4, - PENDING_CHARGE: 5, - PENDING_DISCHARGE: 6 -}; - const PowerManagerInterface = @@ -79,7 +55,7 @@ const Indicator = new Lang.Class({ } let [[device_id, device_type, icon, percentage, state, seconds]] = result; - if (device_type == UPDeviceType.BATTERY) { + if (device_type == UPower.DeviceKind.BATTERY) { let time = Math.round(seconds / 60); if (time == 0) { // 0 is reported when UPower does not have enough data